#include"process.h"
#define times 1000*20
#define load_capcity 1024*1024
#define load_size 1024*10
void download(fun cp)  //回调函数，传入指针函数
{
  int total=0;
  while(total<=load_capcity)
  {
    usleep(times);
    //function_2(total);
    //total++;
    //function_2(total*100/load_capcity);
    int rate=100*total/1024/1024;
    //varprintf("%d\n",rate);
    cp(rate);
    total+=load_size;
  }
  cp(100);
  printf("\n");
}


int main()
{
  download(function_2);
 // int total=0;
 // while(total<=100)
 // {
 //   
 //   usleep(times);
 //   function_2(total);
 //   total++;
 //   //total+=load_size;
 //   //function_2(total*100/load_capcity);
 //   // int rate=(total*100/load_capcity);
 //   //cp(rate);
 // } 
}
